home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / aztarac.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  6KB  |  216 lines

  1. /*
  2.  * Aztarac driver
  3.  *
  4.  * Jul 25 1999 by Mathis Rosenhauer
  5.  *
  6.  * Thanks to David Fish for additional hardware information.
  7.  *
  8.  */
  9.  
  10. #include "driver.h"
  11. #include "vidhrdw/vector.h"
  12.  
  13. /* from machine/foodf.c */
  14. READ_HANDLER( foodf_nvram_r );
  15. WRITE_HANDLER( foodf_nvram_w );
  16. void foodf_nvram_handler(void *file,int read_or_write);
  17.  
  18. /* from vidhrdw/aztarac.c */
  19. void aztarac_init_colors (unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  20. int aztarac_vh_start (void);
  21. WRITE_HANDLER( aztarac_ubr_w );
  22. int aztarac_vg_interrupt(void);
  23.  
  24. extern UINT8 *aztarac_vectorram;
  25.  
  26. /* from sndhrdw/aztarac.c */
  27. READ_HANDLER( aztarac_sound_r );
  28. WRITE_HANDLER( aztarac_sound_w );
  29. READ_HANDLER( aztarac_snd_command_r );
  30. READ_HANDLER( aztarac_snd_status_r );
  31. WRITE_HANDLER( aztarac_snd_status_w );
  32. int aztarac_snd_timed_irq (void);
  33.  
  34. static READ_HANDLER( aztarac_joystick_r )
  35. {
  36.     return (((input_port_0_r (offset) - 0xf) << 8) |
  37.             ((input_port_1_r (offset) - 0xf) & 0xff));
  38. }
  39.  
  40. static struct MemoryReadAddress readmem[] =
  41. {
  42.     { 0x000000, 0x00bfff, MRA_ROM },
  43.     { 0x022000, 0x022fff, foodf_nvram_r },
  44.     { 0x027000, 0x027001, aztarac_joystick_r },
  45.     { 0x027004, 0x027005, input_port_3_r },
  46.     { 0x027008, 0x027009, aztarac_sound_r },
  47.     { 0x02700c, 0x02700d, input_port_2_r },
  48.     { 0x02700e, 0x02700f, watchdog_reset_r },
  49.     { 0xff8000, 0xffafff, MRA_BANK1 },
  50.     { 0xffe000, 0xffffff, MRA_BANK2 },
  51.     { -1 }    /* end of table */
  52. };
  53.  
  54. static struct MemoryWriteAddress writemem[] =
  55. {
  56.     { 0x000000, 0x00bfff, MWA_ROM },
  57.     { 0x022000, 0x022fff, foodf_nvram_w },
  58.     { 0x027008, 0x027009, aztarac_sound_w },
  59.     { 0xff8000, 0xffafff, MWA_BANK1, &aztarac_vectorram },
  60.     { 0xffb000, 0xffb001, aztarac_ubr_w },
  61.     { 0xffe000, 0xffffff, MWA_BANK2 },
  62.     { -1 }    /* end of table */
  63. };
  64.  
  65. static struct MemoryReadAddress sound_readmem[] =
  66. {
  67.     { 0x0000, 0x1fff, MRA_ROM },
  68.     { 0x8000, 0x87ff, MRA_RAM },
  69.     { 0x8800, 0x8800, aztarac_snd_command_r },
  70.     { 0x8c00, 0x8c01, AY8910_read_port_0_r },
  71.     { 0x8c02, 0x8c03, AY8910_read_port_1_r },
  72.     { 0x8c04, 0x8c05, AY8910_read_port_2_r },
  73.     { 0x8c06, 0x8c07, AY8910_read_port_3_r },
  74.     { 0x9000, 0x9000, aztarac_snd_status_r },
  75.     { -1 }    /* end of table */
  76. };
  77.  
  78. static struct MemoryWriteAddress sound_writemem[] =
  79. {
  80.     { 0x0000, 0x1fff, MWA_ROM },
  81.     { 0x8000, 0x87ff, MWA_RAM },
  82.     { 0x8c00, 0x8c00, AY8910_write_port_0_w },
  83.     { 0x8c01, 0x8c01, AY8910_control_port_0_w },
  84.     { 0x8c02, 0x8c02, AY8910_write_port_1_w },
  85.     { 0x8c03, 0x8c03, AY8910_control_port_1_w },
  86.     { 0x8c04, 0x8c04, AY8910_write_port_2_w },
  87.     { 0x8c05, 0x8c05, AY8910_control_port_2_w },
  88.     { 0x8c06, 0x8c06, AY8910_write_port_3_w },
  89.     { 0x8c07, 0x8c07, AY8910_control_port_3_w },
  90.     { 0x9000, 0x9000, aztarac_snd_status_w },
  91.     { -1 }    /* end of table */
  92. };
  93.  
  94.  
  95.  
  96. INPUT_PORTS_START( aztarac )
  97.     PORT_START /* IN0 */
  98.     PORT_ANALOG( 0x1f, 0xf, IPT_AD_STICK_X | IPF_CENTER, 100, 1, 0, 0x1e )
  99.  
  100.     PORT_START /* IN1 */
  101.     PORT_ANALOG( 0x1f, 0xf, IPT_AD_STICK_Y | IPF_CENTER | IPF_REVERSE, 100, 1, 0, 0x1e )
  102.  
  103.     PORT_START /* IN2 */
  104.     PORT_ANALOGX( 0xff, 0x00, IPT_DIAL | IPF_REVERSE, 25, 10, 0, 0, KEYCODE_Z, KEYCODE_X, 0, 0 )
  105.  
  106.     PORT_START /* IN3 */
  107.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
  108.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
  109.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  110.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
  111.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
  112.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  113.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  114.     PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  115. INPUT_PORTS_END
  116.  
  117.  
  118.  
  119. static struct AY8910interface ay8910_interface =
  120. {
  121.     4,    /* 4 chips */
  122.     2000000,    /* 2 MHz */
  123.     { 15, 15, 15, 15 },
  124.     { 0, 0, 0, 0 },
  125.     { 0, 0, 0, 0 },
  126.     { 0, 0, 0, 0 },
  127.     { 0, 0, 0, 0 }
  128. };
  129.  
  130. static struct MachineDriver machine_driver_aztarac =
  131. {
  132.     /* basic machine hardware */
  133.     {
  134.         {
  135.             CPU_M68000,
  136.             8000000, /* 8 MHz */
  137.             readmem, writemem,0,0,
  138.             aztarac_vg_interrupt, 1
  139.         },
  140.         {
  141.             CPU_Z80 | CPU_AUDIO_CPU,
  142.             2000000,    /* 2 MHz */
  143.             sound_readmem,sound_writemem, 0, 0,
  144.             0,0,
  145.             aztarac_snd_timed_irq, 100
  146.         }
  147.     },
  148.     40, 0,    /* frames per second, vblank duration (vector game, so no vblank) */
  149.     1,
  150.     0,
  151.  
  152.     /* video hardware */
  153.     400, 300, { 0, 1024-1, 0, 768-1 },
  154.     0,
  155.     256, 256,
  156.     aztarac_init_colors,
  157.  
  158.     VIDEO_TYPE_VECTOR,
  159.     0,
  160.     aztarac_vh_start,
  161.     vector_vh_stop,
  162.     vector_vh_update,
  163.  
  164.     /* sound hardware */
  165.     0,0,0,0,
  166.     {
  167.         {
  168.             SOUND_AY8910,
  169.             &ay8910_interface
  170.         }
  171.     },
  172.  
  173.     foodf_nvram_handler
  174. };
  175.  
  176. /***************************************************************************
  177.  
  178.   Game driver(s)
  179.  
  180. ***************************************************************************/
  181.  
  182. ROM_START( aztarac )
  183.     ROM_REGION( 0xc000, REGION_CPU1 )
  184.     ROM_LOAD_EVEN( "l8_6.bin", 0x000000, 0x001000, 0x25f8da18 )
  185.     ROM_LOAD_ODD ( "n8_0.bin", 0x000000, 0x001000, 0x04e20626 )
  186.     ROM_LOAD_EVEN( "l7_7.bin", 0x002000, 0x001000, 0x230e244c )
  187.     ROM_LOAD_ODD ( "n7_1.bin", 0x002000, 0x001000, 0x37b12697 )
  188.     ROM_LOAD_EVEN( "l6_8.bin", 0x004000, 0x001000, 0x1293fb9d )
  189.     ROM_LOAD_ODD ( "n6_2.bin", 0x004000, 0x001000, 0x712c206a )
  190.     ROM_LOAD_EVEN( "l5_9.bin", 0x006000, 0x001000, 0x743a6501 )
  191.     ROM_LOAD_ODD ( "n5_3.bin", 0x006000, 0x001000, 0xa65cbf99 )
  192.     ROM_LOAD_EVEN( "l4_a.bin", 0x008000, 0x001000, 0x9cf1b0a1 )
  193.     ROM_LOAD_ODD ( "n4_4.bin", 0x008000, 0x001000, 0x5f0080d5 )
  194.     ROM_LOAD_EVEN( "l3_b.bin", 0x00a000, 0x001000, 0x8cc7f7fa )
  195.     ROM_LOAD_ODD ( "n3_5.bin", 0x00a000, 0x001000, 0x40452376 )
  196.  
  197.     ROM_REGION( 0x10000, REGION_CPU2 )
  198.     ROM_LOAD( "j4_c.bin", 0x0000, 0x1000, 0xe897dfcd )
  199.     ROM_LOAD( "j3_d.bin", 0x1000, 0x1000, 0x4016de77 )
  200. ROM_END
  201.  
  202.  
  203.  
  204. static void init_aztarac(void)
  205. {
  206.     unsigned char *rom = memory_region(REGION_CPU1);
  207.  
  208.     /* patch IRQ vector 4 to autovector location */
  209.     WRITE_WORD(&rom[0x70], 0);
  210.     WRITE_WORD(&rom[0x72], 0x0c02);
  211. }
  212.  
  213.  
  214.  
  215. GAME( 1983, aztarac, 0, aztarac, aztarac, aztarac, ROT0, "Centuri", "Aztarac" )
  216.